<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
	<script src="/js/system.js" type="text/javascript" charset="utf-8"></script>
	<#include "/head.ftl"/>
	<div class="content">
		<div class="tab">
			<div class="tab-header">
				<a href="/system/menu/add" title="增加菜单" class="btn btn-setting btn-add" id="add"> <i class="iconfont icon-add"
					style="font-size: 16px;"></i>
				</a>
				<a title="刷新" class="btn btn-setting" onclick="refresh(this)">
					<i class="iconfont icon-refresh"></i>
				</a>
				<font size="1px" color="#696969">Tip：菜单的修改重新登录才会生效噢！</font>
				<div class="tab-tool">
					<input name="search" type="text" placeholder="查找...">
					<a class="search-btn">
						<i class="iconfont icon-search"></i>
					</a>
				</div>
			</div>
			<div class="tab-content">
				<div>
					<!-- <table id="tt" class="easyui-treegrid" style="width: 100%;" data-options="url:'/system/menu/datas',idField:'id',treeField:'text'">
					    <thead>
					        <tr>
					            <th data-options="field:'text',width: '16%'">名称</th>
					            <th data-options="field:'icon',width: '16%'">图标</th>
					            <th data-options="field:'href',width: '16%'">路径</th>
					            <th data-options="field:'seq',width: '16%'">排序</th>
					            <th data-options="field:'_operate',width: '16%'">操作</th>
					            <th data-options="field:'open',width: '16%',formatter:formatOpen">开启/关闭</th>
					        </tr>
					    </thead>
					</table> -->
					<table style="width: 100%; border-collapse: collapse;">
						<tr>
							<th></th>
							<th>名称</th>
							<th>图标</th>
							<th>路径</th>
							<th>排序</th>
							<th>操作</th>
							<th>开启/关闭</th>
						</tr>
						<#list menus as menu>
							<tr class="tab-content-head" data-id="${menu.id}" data-selfid="${menu.id}">
								<td id="findSon">
									<i class="iconfont icon-enter"style="cursor: pointer;"></i>
									<i class="iconfont icon-unfold" style="display: none;cursor: pointer;"></i>
								</td>
								<td>${menu.text}</td>
								<td>${menu.icon}</td>
								<td>${menu.href}</td>
								<td>${menu.seq}</td>
								<td>
									<!-- <a onclick="changeSeq(this,'up')" class="btn btn-up"><i class="iconfont icon-up"></i><span>上移</span></a>
									<a onclick="changeSeq(this,'down')" class="btn btn-down"><i class="iconfont icon-down"></i><span>下移</span></a> -->
									<a href="/system/menu/add?id=${menu.id}" title="新增菜单" class="btn btn-add"><i class="iconfont icon-add"></i><span>新增子菜单</span></a>
									<a href="/system/menu/getone?id=${menu.id}" title="修改菜单" class="btn btn-update"><i class="iconfont icon-brush"></i><span>修改</span></a>
									<a onclick="deleteMenu(${menu.id},'/system/menu/delete')" class="btn btn-delete"><i class="iconfont icon-trash"></i><span>删除</span></a>
								</td>
								<td data-id="${menu.id}">
									<#if menu.open>
										<input class="easyui-switchbutton" data-options="onText:'开启',offText:'关闭'" checked>
									<#else>
										<input class="easyui-switchbutton" data-options="onText:'开启',offText:'关闭'">
									</#if>
								</td>
							</tr>
							<#list menu.children as children>
								<tr data-id="${children.parent.id}" data-selfid="${children.id}" class="tab-content-son">
									<td></td>
									<td>${children.text}</td>
									<td>${children.icon}</td>
									<td>${children.href}</td>
									<td>${children.seq}</td>
									<td>
										<!-- <a onclick="changeSeq(this,'up')" class="btn btn-up"><i class="iconfont icon-up"></i><span>上移</span></a>
										<a onclick="changeSeq(this,'down')" class="btn btn-down"><i class="iconfont icon-down"></i><span>下移</span></a> -->
										<a onclick="addAuth(this)" class="btn btn-up"><i class="iconfont icon-Key"></i><span> 添加权限</span></a>
										<div id="authForm" style="display: none;">
											<table>
												<tr>
													<td>所属菜单：</td>
													<td>${children.text}</td>
												</tr>
												<tr>
													<td>资源名称：</td>
													<td><input type="text" name="text"></td>
												</tr>
												<tr>
													<td>权限值：</td>
													<td><input type="text" name="power"></td>
												</tr>
												<tr>
													<td>资源路径：</td>
													<td>
														<input type="text" name="url">
														<input type="hidden" name="parent" value="${children.id}">
													</td>
												</tr>
											</table>
										</div>
										<a href="/system/menu/getone?id=${children.id}" title="修改菜单" class="btn btn-update"><i class="iconfont icon-brush"></i><span>修改</span></a>
										<a onclick="deleteMenu(${children.id},'/system/menu/delete')" class="btn btn-delete"><i class="iconfont icon-trash"></i><span>删除</span></a>
									</td>
									<td data-id="${children.id}">
										<#if children.open>
											<input class="easyui-switchbutton" data-options="onText:'开启',offText:'关闭'" checked>
										<#else>
											<input class="easyui-switchbutton" data-options="onText:'开启',offText:'关闭'">
										</#if>
									</td>
								</tr>
								<#list children.children as resource>
									<tr data-id="${children.parent.id}" data-selfid="${resource.id}" class="tab-content-son tab-content-resource">
										<td></td>
										<td>--${resource.text}</td>
										<td>${resource.icon}</td>
										<td>${resource.href}</td>
										<td>${resource.seq}</td>
										<td>
											<a href="/system/menu/getone?id=${children.id}" title="修改菜单" class="btn btn-update"><i class="iconfont icon-brush"></i><span>修改</span></a>
											<a onclick="deleteMenu(${resource.id},'/system/menu/delete')" class="btn btn-delete"><i class="iconfont icon-trash"></i><span>删除</span></a>
										</td>
										<td data-id="${resource.id}"></td>
									</tr>
								</#list>
							</#list>
						</#list>
					</table>
				</div>
			</div>
		</div>

	</div>
</body>

</html>